







Algorithms..::LexicographicalCompare<(Of <T>)> Method (IEnumerable<(Of <T>)>, IEnumerable<(Of <T>)>) |
See Also |
![]() ![]() |
[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Performs a lexicographical comparison of two sequences of values. A lexicographical comparison compares corresponding
pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2,
then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence
are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other,
but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.
Namespace: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
C# |
---|
public static int LexicographicalCompare<T>( IEnumerable<T> sequence1, IEnumerable<T> sequence2 ) where T : IComparable<T> |
Visual Basic (Declaration) |
---|
Public Shared Function LexicographicalCompare(Of T As IComparable(Of T)) ( _ sequence1 As IEnumerable(Of T), _ sequence2 As IEnumerable(Of T) _ ) As Integer |
Visual C++ |
---|
public: generic<typename T> where T : IComparable<T> static int LexicographicalCompare ( IEnumerable<T>^ sequence1, IEnumerable<T>^ sequence2 ) |
Parameters
- sequence1
- IEnumerable<(Of <T>)>
The first sequence to compare.
- sequence2
- IEnumerable<(Of <T>)>
The second sequence to compare.
Return Value
Less than zero if sequence1 is lexicographically less than sequence2. Greater than zero if sequence1 is lexicographically greater than sequence2. Zero if sequence1 is equal to sequence2.
Type Parameters
- T
- Types of items to compare. This type must implement IComparable<T> to allow items to be compared.
Remarks
T must implement either IComparable<T> and this implementation is used
to compare the items.
Exceptions
Exception | Condition |
---|---|
System..::NotSupportedException | T does not implement IComparable<T> or IComparable. |
See Also
Algorithms Class
Wintellect.PowerCollections Namespace